﻿#region Header

/*
    This file is part of ndoctor-statistics.

    ndoctor-statistics is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ndoctor-statistics is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ndoctor-statistics.  If not, see <http://www.gnu.org/licenses/>.
*/

#endregion Header

namespace Probel.NDoctor.Statistics.Domain
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks>
    /// Status colours
    ///  >= 66 : FF3333
    ///  >= 33 : FFCC00
    ///  >=  0 : 66CC66
    ///  </remarks>
    public class Bottleneck
    {
        #region Properties

        public double Accuracy
        {
            get
            {
                return (this.CallCount == 0)
                    ? 0
                    : ((float)this.BottleneckCount / (float)this.CallCount) * 100;
            }
        }

        /// <summary>
        /// Gets or sets the avg execution time in seconds.
        /// </summary>
        /// <value>
        /// The avg execution time.
        /// </value>
        public double AvgExecutionTime
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the avg threshold.
        /// </summary>
        /// <value>
        /// The avg threshold.
        /// </value>
        public double AvgThreshold
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the number of time the bottleneck occured.
        /// </summary>
        /// <value>
        /// The count.
        /// </value>
        public int BottleneckCount
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the number of time this method is called.
        /// </summary>
        /// <value>
        /// The occurence.
        /// </value>
        public int CallCount
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the name of the method of this bottleneck.
        /// </summary>
        /// <value>
        /// The name of the method.
        /// </value>
        public string MethodName
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the name of the target type of this bottleneck.
        /// </summary>
        /// <value>
        /// The name of the target type.
        /// </value>
        public string TargetTypeName
        {
            get;
            set;
        }

        #endregion Properties
    }
}